{include file="public/header" /}
<style>
    .draw-account {
        display: flex;
        justify-content: space-between;
        text-align: center;
    }
</style>
<body class="hide-top bgc">
<div class="draw-container">
    <img src="/static/index/img/icon16.png" alt="">
    <div class="draw-content">
        <div class="draw-hd">
            <i class="layui-icon layui-icon-left" onclick="load_href('{:url(\'user/index\')}',2)"></i>提现
        </div>
        <div class="draw-account">
            <div>
                <p class="price">{:get_pay_way('bonus')}余额</p>
                <p class="num">￥<span>{$user.assets.bonus}</span></p>
            </div>
        </div>
        <form action="{:url('draw/save')}" method="post" class="form layui-form">
            <input type="hidden" name="account" value="bonus">
            <div class="draw-account-news">
                <p class="title">提现金额</p>
                <div class="draw-price">￥
                    <input type="number" name="amount" id="amount" lay-verify="required" lay-reqtext="请输入提现金额"
                           placeholder="请输入提现金额，{$system.draw_min}起提" autocomplete="off">
                    <p class="all">全部</p>
                </div>
                {if $system.draw_cost > 0}
                <div class="flex-layout">
                    手续费
                    <input type="text" value="{$system.draw_cost*100}%" readonly style="text-align: right">
                </div>
                {/if}
                <div class="flex-layout real_amount" style="display: none;">
                    实际到账金额
                    <input type="text" id="real_amount" readonly style="text-align: right">
                </div>
                <div class="flex-layout">
                    支付密码
                    <input type="password" name="pay_password" lay-verify="required" lay-reqtext="请输入支付密码"
                           placeholder="请输入支付密码" style="text-align: right">
                </div>
            </div>
            <div class="draw-account-to flex-layout">
                提现至
                <a class="rgt">
                    <p class="flex-center">
                        <img src="/static/index/img/icon3.png" alt="" class="mode-img" style="display:none;">
                    </p>
                    <span class="mode-text">请选择</span>
                    <i class="layui-icon layui-icon-right"></i>
                </a>
                <input type="hidden" name="mode" id="mode">
            </div>
            <p class="save upd-save" lay-submit lay-filter="save" formObj=".form">申请提现</p>
            <a class="save save1 upd-save" href="{:url('draw/record')}">提现记录</a>
        </form>
        <div style="padding-left: 20px;font-size: 13px">
            <?php echo !empty($system['draw_msg'])? htmlspecialchars_decode($system['draw_msg']): ''?>
        </div>
    </div>
</div>
</body>
{include file="public/footer" /}
<script>
    $(function () {
        $(".all").click(function () {
            var value = "{$user.assets.bonus}";
            $("#amount").val(value);
            if (value) {
                var cost = "{$system.draw_cost}";
                amount = (parseFloat(value) * (1 - parseFloat(cost))).toFixed(2);
                $('#real_amount').val(amount);
                $(".real_amount").show();
            } else {
                $(".real_amount").hide();
            }
        });
        $('#amount').blur(function () {
            var value = $(this).val();
            if (value) {
                var cost = "{$system.draw_cost}";
                amount = (parseFloat(value) * (1 - parseFloat(cost))).toFixed(2);
                $('#real_amount').val(amount);
                $(".real_amount").show();
            } else {
                $(".real_amount").hide();
            }
        });
        $('.draw-account-to').click(function () {
            layer.open({
                type: 2,
                offset: 'b',
                anim: 'slideUp', // 从下往上
                title: '请选择提现方式',
                shadeClose: true,
                shade: 0.8,
                area: ['100%', '70%'],
                content: '{:url(\'draw/mode\')}' //iframe的url
            });
        });
        renderLoad = function (mode, icon, text) {
            $(".mode-img").attr('src', icon).show();
            $(".mode-text").text(text);
            $("#mode").val(mode);
            layer.closeAll();
        }
    });
</script>
</html>